home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _5E8A0D81A5E04DC898F87D09D3EDB74C < prev    next >
Encoding:
Text File  |  2004-01-06  |  3.7 KB  |  116 lines

  1. --------------------------------------------------
  2. --    Created By: Petar
  3.  
  4.  
  5. AIBehaviour.KriegerAttack = {
  6.     Name = "KriegerAttack",
  7.  
  8.  
  9.     ---------------------------------------------
  10.     OnPlayerSeen = function( self, entity, fDistance )
  11.         -- called when the enemy sees a living player
  12.         
  13.     end,
  14.     ---------------------------------------------
  15.     OnPlayerAiming = function ( self, entity, sender)
  16.         if (entity:MutantJump(AIAnchor.MUTANT_JUMP_TARGET_WALKING,30,2+1) == nil) then 
  17.             local rnd = random(1.10);
  18.             if (rnd == 5) then
  19.                 entity:SelectPipe(0,"fast_hide");    
  20.             end
  21.         end
  22.     end,
  23.  
  24.     ---------------------------------------------
  25.     OnPlayerLookingAway =  function( self, entity, fDistance )
  26.         entity:GoRefractive();
  27.         local rnd = random(1.2);
  28.         if (rnd == 1) then 
  29.             entity:SelectPipe(0,"fast_invisible_attack_left");
  30.         else
  31.             entity:SelectPipe(0,"fast_invisible_attack_right");
  32.         end
  33.     end,
  34.  
  35.     
  36.     ---------------------------------------------
  37.     OnEnemyMemory = function( self, entity )
  38.         -- called when the enemy can no longer see its foe, but remembers where it saw it last
  39.         if (entity.VISIBLE) then 
  40.             if (entity:MutantJump(AIAnchor.MUTANT_JUMP_TARGET_WALKING,30,2+1) == nil) then
  41.                 entity:SelectPipe(0,"fast_shoot_approach");
  42.             end
  43.         else
  44.             Hud:AddMessage("invisible?");
  45.         end
  46.     end,
  47.     ---------------------------------------------
  48.     OnInterestingSoundHeard = function( self, entity )
  49.         -- called when the enemy hears an interesting sound
  50.         entity:SelectPipe(0,"fast_shoot_approach");
  51.  
  52.     end,
  53.     ---------------------------------------------
  54.     OnThreateningSoundHeard = function( self, entity )
  55.         -- called when the enemy hears a scary sound
  56.         entity:MakeAlerted();
  57.         entity:SelectPipe(0,"fast_shoot_approach");
  58.     end,
  59.     ---------------------------------------------
  60.     OnReload = function( self, entity )
  61.         -- called when the enemy goes into automatic reload after its clip is empty
  62.     end,
  63.     ---------------------------------------------
  64.     OnGroupMemberDied = function( self, entity )
  65.         -- called when a member of the group dies
  66.     end,
  67.     ---------------------------------------------
  68.     OnNoHidingPlace = function( self, entity, sender )
  69.         -- called when no hiding place can be found with the specified parameters
  70.     end,    
  71.     ---------------------------------------------
  72.     OnReceivingDamage = function ( self, entity, sender)
  73.         entity:GoVisible();
  74.         entity:SelectPipe(0,"fast_hide");
  75.     end,
  76.     --------------------------------------------------
  77.     OnBulletRain = function ( self, entity, sender)
  78.         entity:MakeAlerted();
  79.         -- called when the enemy detects bullet trails around him
  80.     end,
  81.     --------------------------------------------------
  82.     OnCloseContact = function ( self, entity, sender)
  83.         entity:GoVisible();
  84.         if (entity.MELEE_ANIM_COUNT) then
  85.             local rnd = random(1,entity.MELEE_ANIM_COUNT);
  86.             local melee_anim_name = format("attack_melee%01d",rnd);
  87.             entity:InsertAnimationPipe(melee_anim_name,3);
  88.         else
  89.             Hud:AddMessage("==================UNACCEPTABLE ERROR====================");
  90.             Hud:AddMessage("Entity "..entity:GetName().." made melee attack but has no melee animations.");
  91.             Hud:AddMessage("==================UNACCEPTABLE ERROR====================");
  92.         end
  93.     end,
  94.     --------------------------------------------------
  95.  
  96.     SWITCH_TO_SHOOT = function ( self, entity, sender)
  97.         entity:SelectPipe(0,"krieger_fast_shoot");
  98.     end,
  99.     --------------------------------------------------
  100.  
  101.     CHANGE_POSITION = function ( self, entity, sender)
  102.         entity:SelectPipe(0,"fast_hide");
  103.     end,
  104.     --------------------------------------------------
  105.  
  106.     
  107.  
  108.     
  109.     JUMP_FINISHED = function (self, entity, sender)
  110.         if (self.Walking) then
  111.             entity:SelectPipe(0,"fast_shoot_approach");
  112.         else
  113.             entity:SelectPipe(0,"krieger_fast_shoot");
  114.         end
  115.     end,
  116. }